home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1987 June / 1987-06.d64 / directory plus (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  6KB  |  213 lines

  1. 10 n$="zz":poke53281,0:poke53280,0:nr=214:nc=211:kb=198:poke808,225
  2. 15 gosub2000
  3. 20 goto470
  4. 30 pokenr,1:print:print"[159]are you sure? (y/n)"
  5. 40 pokekb,0
  6. 50 getk$:ifk$=""then50
  7. 60 pokekb,0:return
  8. 70 gosub100:pokenr,1:print:print"[159]*** working ****    ":return
  9. 80 pokenr,1:print"[159]":printmid$(m$,4,16):return
  10. 90 m$="":pokenr,1:print:print"                              ":gosub120:return
  11. 100 pokenr,rl+2:print:printtab(cl*20);"[158]"mid$(n$(rl+(i+1)*cl+d-1),4,16)
  12. 110 return
  13. 120 pokenr,r+2:print:printtab(c*20);"[159]";mid$(n$(r+(i+1)*c+d-1),4,16)
  14. 130 return
  15. 140 print"[147][158]"he$;
  16. 150 ifd>1thenpokenc,21:print" p = prior screen "
  17. 160 ifd=<n-40thenpokenc,21:print" n = next screen  "
  18. 170 i=int((n-d-1)/2+.5):ifi>19theni=19
  19. 180 gosub80:pokenr,3:print"[158]"
  20. 190 forx=dtod+i
  21. 200 printmid$(n$(x),4,16)",";
  22. 210 printt$(asc(n$(x))andnot248);
  23. 220 if(asc(n$(x))and64)=64thenprint"<";
  24. 230 ifasc(n$(x+i+1)+chr$(0))=0then280
  25. 240 printtab(20);mid$(n$(x+i+1),4,16)",";
  26. 250 printt$(asc(n$(x+i+1))andnot248);
  27. 260 if(asc(n$(x+i+1))and64)=64thenprint"<";
  28. 270 print
  29. 280 next:ifr>i+1thenr=i+1
  30. 285 ifr<1thenr=1
  31. 290 gosub120:return
  32. 300 gosub40:cl=c:rl=r
  33. 310 ifk$=chr$(13)ork$="[133]"ork$="-"ork$=","ork$=" "ork$=""thenreturn
  34. 313 ifk$="r"thenreturn
  35. 315 ifk$="[136]"thenreturn
  36. 317 ifk$="[134]"thenreturn
  37. 320 ifk$=""thenr=1:c=0
  38. 330 ifk$=""ork$="[157]"thenc=notcand1
  39. 340 ifk$=""ork$="[145]"thenr=(r+1+2*(k$>""))
  40. 350 ifc>n-1thenr=1:c=0
  41. 360 ifr>i+1thenr=1
  42. 370 ifr<1thenr=i+1
  43. 380 ifn$(r+(i+1)*c+d-1)=""then330
  44. 390 if(cl<>c)or(rl<>r)thengosub100:gosub120
  45. 400 ifk$="p"andd>1thend=d-40:gosub140
  46. 410 ifk$="n"andd=<n-40thend=d+40:gosub140
  47. 420 goto300
  48. 430 pokenr,7:print:print"   [158]are you sure? (y/n)    "
  49. 440 gosub40:ifk$="y"then1440
  50. 450 ifk$=""then440
  51. 460 return
  52. 470 print"[147][159][213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]
  53. 480 [153]"peek     sysdirectory fileropen      peek"
  54. 490 [153]"peek                          peek"
  55. 500 [153]"peek sysinsert diskette in driveopen peek"
  56. 510 [153]"mid$tantantantantantantantantantantantantantantantantantantantantantantantantantan(NULL)
  57. 520 forx=1to6:n$=n$+n$:next
  58. 530 n$=mid$(n$,2):n$=n$+n$
  59. 540 forx=828to861
  60. 550 ready:pokex,y:next
  61. 560 forx=1to30:z$=z$+chr$(0):next
  62. 570 dimn$(144),s(18),t$(4):d=1:n=0:f=0:b=1:r=1:c=0
  63. 575 dimb%(144)
  64. 580 forx=0to17:ready:s(x)=y:next
  65. 590 t$(1)="s":t$(2)="p":t$(3)="u":t$(4)="r"
  66. 600 ln$=chr$(130)+chr$(18)+chr$(18)+"----------------"+left$(z$,11)
  67. 610 print"[213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  68. 620 print"[194] [158]press return[146] to continue[159] [194]"
  69. 630 print"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
  70. 640 gosub40:ifk$=""thengosub430
  71. 650 pokenr,7:print:print"    [158]reading disk name     "
  72. 660 open15,8,15,"i0":open1,8,3,"$"
  73. 670 sys828:input#15,en$,em$:ifen$="00"then710
  74. 680 pokenr,7:print
  75. 690 print"   [158]disk read error # "en$"  "
  76. 700 print:goto1480
  77. 710 he$=mid$(n$,143,16)+","+mid$(n$,161,2)
  78. 720 pokenr,3:print:print"   "he$"    "
  79. 730 pokenr,7:print:print"    reading entry #"n"  "
  80. 740 sys828:forx=1to254step32:y=asc(mid$(n$,x,1))and127
  81. 750 ify=0then770
  82. 760 n=n+1:n$(n)=mid$(n$,x,30)
  83. 770 pokenr,7:print:pokenc,20:printn
  84. 780 next
  85. 790 ifst=0then730
  86. 800 print"[145]    total entries ="
  87. 810 forx=1to1500:next
  88. 820 close1
  89. 825 ifn=0thenprint"[147]":goto1410
  90. 830 m$="":gosub140
  91. 840 gosub300:f=r+(i+1)*c+d-1
  92. 850 ifk$="-"then990
  93. 860 ifk$=" "andn>1then1040
  94. 870 ifk$=","then1120
  95. 875 ifk$="r"then1600
  96. 880 ifk$=""then1190
  97. 890 ifk$="[133]"then1230
  98. 895 ifk$="[134]"then1700
  99. 897 ifk$="[136]"thengosub2000:gosub140:goto840
  100. 900 m$=n$(f):gosub80
  101. 910 gosub300:t=r+(i+1)*c+d-1
  102. 920 iff=t-1orf=tthengosub90:goto840
  103. 930 gosub70
  104. 940 iff>tthenv=-1
  105. 950 iff<tthenv=1:t=t-1
  106. 960 n$(f)=n$(f+v):f=f+v:iff<>tthen960
  107. 970 n$(t)=m$
  108. 980 goto830
  109. 990 ifn<144then997
  110. 995 pokenr,1:print:print"[159]too many files":forx=1to2000:next:gosub90:goto840
  111. 997 gosub70:b=0
  112. 1000 n=n+1:forx=ntof+1step-1
  113. 1010 n$(x)=n$(x-1):next
  114. 1020 n$(f)=ln$
  115. 1030 goto830
  116. 1040 gosub30:ifk$<>"y"thengosub90:goto840
  117. 1050 gosub70:b=0
  118. 1060 n=n-1:forx=fton
  119. 1070 n$(x)=n$(x+1):next
  120. 1080 n$(n+1)=""
  121. 1090 ifn<c+1thenc=0
  122. 1100 iff=n+1thenr=r+(r>1)
  123. 1105 ifd>nthend=d-40
  124. 1110 goto830
  125. 1120 a=asc(n$(f))
  126. 1130 ifa=130thena=194:goto1150
  127. 1140 ifa=194thena=130
  128. 1150 n$(f)=chr$(a)+right$(n$(f),29)
  129. 1160 pokenr,rl+2:print:printtab(cl*20+18);
  130. 1170 print"[158]"chr$(-60*(a=194));chr$(-32*(a=130))
  131. 1180 goto840
  132. 1190 gosub100
  133. 1200 gosub30:ifk$="y"then1410
  134. 1210 ifk$=""then1200
  135. 1220 gosub90:goto840
  136. 1230 gosub100:gosub30:ifk$<>"y"thengosub90:goto840
  137. 1240 pokenr,1:print:print"[159]writing directory  "
  138. 1250 ifn/8=int(n/8)then1270
  139. 1260 n=n+1:n$(n)=z$:goto1250
  140. 1270 s=0:t=18:s(n/8+.5)=255:n=1:open2,8,2,"#"
  141. 1280 ifs(s+1)=255thent=0
  142. 1290 print#15,"b-p";2;0
  143. 1300 print#2,chr$(t);chr$(s(s+1));:p=2
  144. 1310 forx=nton+7:print#15,"b-p";2;p
  145. 1320 print#2,n$(x);:p=p+32:next:n=x
  146. 1330 print#15,"u2";2;0;18;s(s):input#15,en$,em$:ifen$="00"then1370
  147. 1340 pokenr,1:print
  148. 1350 print"[159] disk write error # "en$
  149. 1360 fort=1to2000:next:goto1440
  150. 1370 s=s+1:ifs(s)<>255goto1280
  151. 1380 ifbthen1410
  152. 1390 print#2,chr$(0);chr$(255);z$:print#15,"u2";2;0;18;18
  153. 1400 pokenr,1:print:print"[159]validating bam    ":print#15,"v0"
  154. 1410 close2:print#15,"i0":close15
  155. 1420 pokenr,1:print:print"[159]another disk? (y/n)"
  156. 1430 gosub40:ifk$="y"thenrun
  157. 1440 print"[147]":pokenr,7:print
  158. 1450 print"[159][213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  159. 1460 print"[194]    [158]program terminated    [159][194]"
  160. 1470 print"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]"
  161. 1480 close1:close2:close15
  162. 1490 sys65418
  163. 1495 end
  164. 1500 data 160,2,177,45,153,137,0,200,192,6,208,246,162
  165. 1510 data 1,32,198,255,32,228,255,164,142,145,140,200
  166. 1520 data 132,142,196,139,208,242,76,204,255
  167. 1530 data 1,4,7,10,13,16,2,5,8,11,14,17,3,6,9,12,15,18
  168. 1600 nn$="":pokenr,1:print:input"[159]new name ";nn$:gosub90:ifnn$=""then830
  169. 1610 nn$=left$(nn$,16):gosub70
  170. 1620 iflen(nn$)<16 then nn$=nn$+chr$(160):goto1620
  171. 1630 du=0:forx=1ton:ifnn$=mid$(n$(x),4,16)thendu=1:x=n
  172. 1640 next:ifdu=0then1670
  173. 1650 pokenr,1:print:print"[159]duplicate name "nn$:forx=1to2000:next:goto830
  174. 1670 m$=n$(f):n$(f)=left$(m$,3)+nn$+right$(m$,len(m$)-19):goto830
  175. 1700 pokenr,1:print:print"[159]turn printer on - press return"
  176. 1710 gosub40:ifk$=""thengosub90:goto840
  177. 1715 ifk$<>chr$(13)then1710
  178. 1720 gosub90:open4,4:ifst<>0then1700
  179. 1730 pokenr,1:print:print"[159]line up paper and press return"
  180. 1740 gosub40:ifk$=""then1790
  181. 1745 ifk$<>chr$(13)then1740
  182. 1750 gosub90:gosub70:b%(0)=664:forx=1ton
  183. 1752 b%(x)=asc(mid$(n$(x),30,1))*256+asc(mid$(n$(x),29,1)):b%(0)=b%(0)-b%(x)
  184. 1754 next:print#4,chr$(15);chr$(145);he$;" ";n;"files";b%(0);"free":print#4
  185. 1760 forx=1to30:x$="":fory=1to4
  186. 1765 w=(y-1)*30+x:ifw>nthen1780
  187. 1767 w$=str$(b%(w)):w$=right$(w$,len(w$)-1)
  188. 1769 iflen(w$)<4thenw$=w$+" ":goto1769
  189. 1770 x$=x$+w$+mid$(n$(w),4,16)
  190. 1780 nexty:print#4,x$:nextx:print#4
  191. 1790 close4:gosub90:goto840
  192. 2000 print"[147][159]";
  193. 2010 print" [213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  194. 2020 print" [194]      [158]directory filer commands[159]      [194]":gosub4010
  195. 2040 print" [194]   [158]n     next screen of files[159]       [194]"
  196. 2050 print" [194]   [158]p     previous screen of files[159]   [194]":gosub4010
  197. 2060 print" [194]   [158]-     insert divider above file[159]  [194]"
  198. 2070 print" [194]   [158]r     rename this file[159]           [194]"
  199. 2075 print" [194]   [158],     lock/unlock this file[159]      [194]":gosub4010
  200. 2080 print" [194] [158]<crsr>  move cursor[159]                [194]"
  201. 2090 print" [194] [158]<home>  move cursor to top[159]         [194]"
  202. 3000 print" [194] [158]<stop>  abort current directory[159]    [194]":gosub4010
  203. 3020 p